package com.gss.armory.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;



@Entity
@Table(name="BUSINESS_UNIT_DETAILS")
public class BusinessUnitDetailsDTO implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6668018137938567811L;
	
	private int buId;
	private String buName;
	private String buCode;
	private String buDesc;
	private String buType;
	private int buCompany;
	private Date buExistenceDate;
	private String buAddressDetails;
	private List<DepartmentDetailsDTO> buDepttList = new ArrayList<DepartmentDetailsDTO>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="BU_ID")
	public int getBuId() {
		return buId;
	}
	@Column(name="BU_NAME",nullable=false,length=100)
	public String getBuName() {
		return buName;
	}
	@Column(name="BU_CODE",nullable=false,length=20,unique=true)
	public String getBuCode() {
		return buCode;
	}
	@Column(name="BU_DESC",length=250)
	public String getBuDesc() {
		return buDesc;
	}
	@Column(name="BU_TYPE",length=100,nullable=false)
	public String getBuType() {
		return buType;
	}
	@Column(name="BU_COMPANY_ID")
	public int getBuCompany() {
		return buCompany;
	}
	@Column(name="BU_EXISTENCE_DATE")
	public Date getBuExistenceDate() {
		return buExistenceDate;
	}
	@Column(name="BU_ADDRESS",length=250)
	public String getBuAddressDetails() {
		return buAddressDetails;
	}
	@ManyToMany(targetEntity=DepartmentDetailsDTO.class,fetch=FetchType.EAGER)
	@JoinTable(name="BU_DEPTT_MAPPING",joinColumns={@JoinColumn(name="BUDM_BU_ID")},inverseJoinColumns={@JoinColumn(name="BUDM_DEPTT_ID")})
	public List<DepartmentDetailsDTO> getBuDepttList() {
		return buDepttList;
	}
	public void setBuId(int buId) {
		this.buId = buId;
	}
	public void setBuName(String buName) {
		this.buName = buName;
	}
	public void setBuCode(String buCode) {
		this.buCode = buCode;
	}
	public void setBuDesc(String buDesc) {
		this.buDesc = buDesc;
	}
	public void setBuType(String buType) {
		this.buType = buType;
	}
	public void setBuCompany(int buCompany) {
		this.buCompany = buCompany;
	}
	public void setBuExistenceDate(Date buExistenceDate) {
		this.buExistenceDate = buExistenceDate;
	}
	public void setBuAddressDetails(String buAddressDetails) {
		this.buAddressDetails = buAddressDetails;
	}
	public void setBuDepttList(List<DepartmentDetailsDTO> buDepttList) {
		this.buDepttList = buDepttList;
	}
	
	
}
